﻿using System;
using System.Windows.Data;

namespace Utils.WP7.Bing
{
    public class TotalSecondsConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            long seconds = (long)value;
            if (seconds > 60)
            {
                return String.Format("{0} min", Math.Round((double)(seconds / 60), 0));
            }
            else
            {
                return String.Format("{0} sec", seconds);
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
